package com.wjc.train.member.feign;

import com.wjc.train.common.req.MemberTicketSaveReq;
import com.wjc.train.common.resp.CommonResp;
import com.wjc.train.member.service.ITicketService;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 会员车票 前端控制器
 * </p>
 *
 * @author Guessed
 * @since 2023-08-22
 */
@RestController
@Validated
@RequestMapping("/feign/ticket")
public class FeignTicketController {

    @Resource
    private ITicketService ticketService;

    @PostMapping("/save")
    public CommonResp save(@RequestBody @Valid MemberTicketSaveReq ticketSaveReq){
        ticketService.save(ticketSaveReq);
        return CommonResp.success();
    }

    @PostMapping("/saveList")
    public CommonResp saveList(@RequestBody @Valid List<MemberTicketSaveReq> ticketSaveReqList){
        ticketService.saveList(ticketSaveReqList);
        return CommonResp.success();
    }

}


